class Solution:
    def minNumberOperations(self, target: List[int]) -> int:
        ans = target[0]
        for x, y in pairwise(target):# 它的作用是将序列中的元素两两配对
            ans += max(y - x, 0)
        return ans 